package com.yss.reportworld.api.factory;

import com.yss.common.core.domain.YssResponse;
import com.yss.reportworld.api.RemoteDatabaseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;


/**
 * 检查报表世界基础数据
 */
@Component
public class RemoteDatabaseFallbackFactory implements FallbackFactory<RemoteDatabaseService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteDatabaseFallbackFactory.class);

    @Override
    public RemoteDatabaseService create(Throwable throwable) {
        log.error("报表世界基础数据服务调用失败:{}", throwable.getMessage());
        return new RemoteDatabaseService() {
            @Override
            public YssResponse<String> queryCheckDataBaseInfoAll(String source) {
                return YssResponse.fail("检查基础数据信息失败:" + throwable.getMessage());
            }
        };
    }
}
